\(\int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx\) [1449]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 75 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {3 a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {b \cot (c+d x)}{d}+\frac {3 a \sec (c+d x)}{2 d}-\frac {a \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {b \tan (c+d x)}{d} \]

[Out]

-3/2*a*arctanh(cos(d*x+c))/d-b*cot(d*x+c)/d+3/2*a*sec(d*x+c)/d-1/2*a*csc(d*x+c)^2*sec(d*x+c)/d+b*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.259, Rules used = {2917, 2702, 294, 327, 213, 2700, 14} \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {3 a \text {arctanh}(\cos (c+d x))}{2 d}+\frac {3 a \sec (c+d x)}{2 d}-\frac {a \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {b \tan (c+d x)}{d}-\frac {b \cot (c+d x)}{d} \]

[In]

Int[Csc[c + d*x]^3*Sec[c + d*x]^2*(a + b*Sin[c + d*x]),x]

[Out]

(-3*a*ArcTanh[Cos[c + d*x]])/(2*d) - (b*Cot[c + d*x])/d + (3*a*Sec[c + d*x])/(2*d) - (a*Csc[c + d*x]^2*Sec[c +
 d*x])/(2*d) + (b*Tan[c + d*x])/d

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2700

Int[csc[(e_.) + (f_.)*(x_)]^(m_.)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(1 + x^2)^((
m + n)/2 - 1)/x^m, x], x, Tan[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n)/2]

Rule 2702

Int[csc[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Dist[1/(f*a^n), Subst[Int
[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/2), x], x, a*Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n
 + 1)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \csc ^3(c+d x) \sec ^2(c+d x) \, dx+b \int \csc ^2(c+d x) \sec ^2(c+d x) \, dx \\ & = \frac {a \text {Subst}\left (\int \frac {x^4}{\left (-1+x^2\right )^2} \, dx,x,\sec (c+d x)\right )}{d}+\frac {b \text {Subst}\left (\int \frac {1+x^2}{x^2} \, dx,x,\tan (c+d x)\right )}{d} \\ & = -\frac {a \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {(3 a) \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{2 d}+\frac {b \text {Subst}\left (\int \left (1+\frac {1}{x^2}\right ) \, dx,x,\tan (c+d x)\right )}{d} \\ & = -\frac {b \cot (c+d x)}{d}+\frac {3 a \sec (c+d x)}{2 d}-\frac {a \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {b \tan (c+d x)}{d}+\frac {(3 a) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{2 d} \\ & = -\frac {3 a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {b \cot (c+d x)}{d}+\frac {3 a \sec (c+d x)}{2 d}-\frac {a \csc ^2(c+d x) \sec (c+d x)}{2 d}+\frac {b \tan (c+d x)}{d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(172\) vs. \(2(75)=150\).

Time = 0.29 (sec) , antiderivative size = 172, normalized size of antiderivative = 2.29 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {2 b \cot (2 (c+d x))}{d}-\frac {a \csc ^2\left (\frac {1}{2} (c+d x)\right )}{8 d}-\frac {3 a \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}+\frac {3 a \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}+\frac {a \sec ^2\left (\frac {1}{2} (c+d x)\right )}{8 d}+\frac {a \sin \left (\frac {1}{2} (c+d x)\right )}{d \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}-\frac {a \sin \left (\frac {1}{2} (c+d x)\right )}{d \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )} \]

[In]

Integrate[Csc[c + d*x]^3*Sec[c + d*x]^2*(a + b*Sin[c + d*x]),x]

[Out]

(-2*b*Cot[2*(c + d*x)])/d - (a*Csc[(c + d*x)/2]^2)/(8*d) - (3*a*Log[Cos[(c + d*x)/2]])/(2*d) + (3*a*Log[Sin[(c
 + d*x)/2]])/(2*d) + (a*Sec[(c + d*x)/2]^2)/(8*d) + (a*Sin[(c + d*x)/2])/(d*(Cos[(c + d*x)/2] - Sin[(c + d*x)/
2])) - (a*Sin[(c + d*x)/2])/(d*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2]))

Maple [A] (verified)

Time = 0.65 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.11

method result size
derivativedivides \(\frac {a \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) \(83\)
default \(\frac {a \left (-\frac {1}{2 \sin \left (d x +c \right )^{2} \cos \left (d x +c \right )}+\frac {3}{2 \cos \left (d x +c \right )}+\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )}{d}\) \(83\)
parallelrisch \(\frac {\left (12 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a -12 a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a +4 b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a \left (\cot ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+4 b \cot \left (\frac {d x}{2}+\frac {c}{2}\right )-24 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-18 a}{8 d \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-8 d}\) \(119\)
risch \(-\frac {i \left (3 i a \,{\mathrm e}^{5 i \left (d x +c \right )}-2 i a \,{\mathrm e}^{3 i \left (d x +c \right )}+3 i a \,{\mathrm e}^{i \left (d x +c \right )}+4 b \,{\mathrm e}^{2 i \left (d x +c \right )}-4 b \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {3 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}+\frac {3 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}\) \(125\)
norman \(\frac {\frac {a}{8 d}-\frac {9 a \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {a \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}+\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d}-\frac {5 b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-\frac {5 b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}+\frac {b \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-\frac {2 a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}+\frac {3 a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}\) \(184\)

[In]

int(csc(d*x+c)^3*sec(d*x+c)^2*(a+b*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(-1/2/sin(d*x+c)^2/cos(d*x+c)+3/2/cos(d*x+c)+3/2*ln(csc(d*x+c)-cot(d*x+c)))+b*(1/sin(d*x+c)/cos(d*x+c)-
2*cot(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.71 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=\frac {6 \, a \cos \left (d x + c\right )^{2} - 3 \, {\left (a \cos \left (d x + c\right )^{3} - a \cos \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 3 \, {\left (a \cos \left (d x + c\right )^{3} - a \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 4 \, {\left (2 \, b \cos \left (d x + c\right )^{2} - b\right )} \sin \left (d x + c\right ) - 4 \, a}{4 \, {\left (d \cos \left (d x + c\right )^{3} - d \cos \left (d x + c\right )\right )}} \]

[In]

integrate(csc(d*x+c)^3*sec(d*x+c)^2*(a+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/4*(6*a*cos(d*x + c)^2 - 3*(a*cos(d*x + c)^3 - a*cos(d*x + c))*log(1/2*cos(d*x + c) + 1/2) + 3*(a*cos(d*x + c
)^3 - a*cos(d*x + c))*log(-1/2*cos(d*x + c) + 1/2) + 4*(2*b*cos(d*x + c)^2 - b)*sin(d*x + c) - 4*a)/(d*cos(d*x
 + c)^3 - d*cos(d*x + c))

Sympy [F(-1)]

Timed out. \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=\text {Timed out} \]

[In]

integrate(csc(d*x+c)**3*sec(d*x+c)**2*(a+b*sin(d*x+c)),x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.12 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=\frac {a {\left (\frac {2 \, {\left (3 \, \cos \left (d x + c\right )^{2} - 2\right )}}{\cos \left (d x + c\right )^{3} - \cos \left (d x + c\right )} - 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 4 \, b {\left (\frac {1}{\tan \left (d x + c\right )} - \tan \left (d x + c\right )\right )}}{4 \, d} \]

[In]

integrate(csc(d*x+c)^3*sec(d*x+c)^2*(a+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

1/4*(a*(2*(3*cos(d*x + c)^2 - 2)/(cos(d*x + c)^3 - cos(d*x + c)) - 3*log(cos(d*x + c) + 1) + 3*log(cos(d*x + c
) - 1)) - 4*b*(1/tan(d*x + c) - tan(d*x + c)))/d

Giac [A] (verification not implemented)

none

Time = 0.44 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.55 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 \, a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 4 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {16 \, {\left (b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} - \frac {18 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 4 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}}}{8 \, d} \]

[In]

integrate(csc(d*x+c)^3*sec(d*x+c)^2*(a+b*sin(d*x+c)),x, algorithm="giac")

[Out]

1/8*(a*tan(1/2*d*x + 1/2*c)^2 + 12*a*log(abs(tan(1/2*d*x + 1/2*c))) + 4*b*tan(1/2*d*x + 1/2*c) - 16*(b*tan(1/2
*d*x + 1/2*c) + a)/(tan(1/2*d*x + 1/2*c)^2 - 1) - (18*a*tan(1/2*d*x + 1/2*c)^2 + 4*b*tan(1/2*d*x + 1/2*c) + a)
/tan(1/2*d*x + 1/2*c)^2)/d

Mupad [B] (verification not implemented)

Time = 11.38 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.69 \[ \int \csc ^3(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x)) \, dx=\frac {b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}-\frac {-10\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-\frac {17\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{2}+2\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\frac {a}{2}}{d\,\left (4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\right )}+\frac {a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}+\frac {3\,a\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{2\,d} \]

[In]

int((a + b*sin(c + d*x))/(cos(c + d*x)^2*sin(c + d*x)^3),x)

[Out]

(b*tan(c/2 + (d*x)/2))/(2*d) - (a/2 + 2*b*tan(c/2 + (d*x)/2) - (17*a*tan(c/2 + (d*x)/2)^2)/2 - 10*b*tan(c/2 +
(d*x)/2)^3)/(d*(4*tan(c/2 + (d*x)/2)^2 - 4*tan(c/2 + (d*x)/2)^4)) + (a*tan(c/2 + (d*x)/2)^2)/(8*d) + (3*a*log(
tan(c/2 + (d*x)/2)))/(2*d)